mybatis @MapperScan 解析 您所在的位置:网站首页 解决WARNSkipping MapperFactoryBean with name mybatis @MapperScan 解析

mybatis @MapperScan 解析

2024-04-01 01:48| 来源: 网络整理| 查看: 265

大家好,又见面了,我是你们的朋友全栈君。

MapperScan 注解会引入 MapperScannerRegistrar,MapperScannerRegistrar 实现了 ImportBeanDefinitionRegistrar,可以向 beanFactory 中 注册 BeanDefinition,具体注入的过程是通过 ClassPathMapperScanner 实现的。

public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { AnnotationAttributes annoAttrs = AnnotationAttributes.fromMap(importingClassMetadata.getAnnotationAttributes(MapperScan.class.getName())); ClassPathMapperScanner scanner = new ClassPathMapperScanner(registry); // this check is needed in Spring 3.1 if (resourceLoader != null) { scanner.setResourceLoader(resourceLoader); } Class markerInterface = annoAttrs.getClass("markerInterface"); if (!Class.class.equals(markerInterface)) { scanner.setMarkerInterface(markerInterface); } Class


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有